<template>
	<view>

	</view>
</template>
<script>
	export default {
		components: {},
		data() {
			return {
				dataInfo:"",
				id:"",
				token:"",
				orderNo: "",
				payType: 30,
				orderPrice:""
			};
		},
		// 
		onLoad() {
			// console.log(window.location.href.split('?')[1])
			let data=window.location.href.split('?')[1].split("&")
			this.orderNo=data[0].split('=')[1]
			this.orderPrice=data[1].split('=')[1]
			this.id=data[2].split('=')[1]
			this.token=data[3].split('=')[1]
			console.log(this.orderNo,this.orderPrice,this.id,this.token)
			this.getInfo()
		},
		onShow() {},

		//下拉刷新
		onPullDownRefresh() {},
		methods: {
			getUrlParam(name) {
				var reg = new RegExp('(^|&)' + name + '=([^&]*)(&|$)')
			},
			getInfo() {
				let data={
					orderNo: this.orderNo,
					payType: this.payType,
					orderPrice: this.orderPrice
				}
				let header = {
					'Accept': 'application/json',
					'Content-Type': 'application/json',
				}
				header["Authorization"] = "Bearer " + this.token
				header["userId"] = this.id
				uni.request({
					url: "https://vsapi.bxwhl.com/api/order/orderMemberPay",
					data: data,
					method: "GET",
					header: header,
					timeout: 15000,
					success: (res) => {
						console.log("成功",res.data.data.resultValue.body)
						const div = document.createElement('div')
						div.id = 'alipay'
						div.innerHTML = res.data.data.resultValue.body
						document.body.appendChild(div)
						document.querySelector('#alipay').children[0].submit()
						console.log(res)

					},
					fail: (res) => {
						console.log("失败",res)
						uni.showToast({
							title: '网络错误',
							icon: 'none',
							duration: 1500,
							mask: true
						})
					},
					complete: (res) => {
						console.log("结束",res)
						console.log(res)
						uni.hideLoading()
					}
				})
			}
		}
	}
</script>
<style scoped>

</style>
